package com.zsrt.java.day20161226.cg.demo03.method02;

import java.util.Scanner;

public class ChangeTest{
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	System.out.println("请输入第一个数a");
	int a = sc.nextInt();
	System.out.println("请输入第二个数b");
	int b = sc.nextInt();
	sc.close();
	 System.out.println("a= "+ a +"\t" + "b= "+ b);
	change(a,b);
	 
}

/**
 * 输入两个数，然后从小到大排列
 * @param int a
 * @param int b
 * 
 */
	
	public static void change(int a, int b){
		if(a > b){
//			int temp;
//			temp = a;
//			a = b;
//			b = temp; 
//	 位运算异或：
			a = a ^ b;
			b = a ^ b;
			a = a ^ b;
			System.out.println("a= "+ a +"\t" + "b= "+ b);
		}
	}
}
